<?php

namespace app\hospital\controller;
use app\BaseController;
use think\facade\Db;
use think\facade\Request;
use think\facade\Session;
use think\facade\View;
use app\hospital\model\patientreserve;
class patientreserveee
{
    function list(){
        $key=Request::param('key');
        if(!empty($key)){
            $d=new patientreserve();
            $data=$d->search();
        }else{
            $data=Db::table('patientreserve')->paginate(5);
        }
        View::assign('data',$data);
        return View::fetch();
    }
    function today(){
        $time=date('Y-m-d');
        $key=Request::param('key');
        if(!empty($key)){
            $d=new patientreserve();
            $data=$d->where('rtime',$time)->search();
        }else{
            $data=Db::table('patientreserve')->where('rtime',$time)->paginate(5);
        }
        View::assign('data',$data);
        return View::fetch();
    }
    public function del(){
        $id=Request::param('id');
//        $d=new subjecttype();
        $res=Db::table('patientreserve')->where('num',$id)->delete();
//        $res=$d->del();
        if(!empty($res)){
            return 1;
        }else{
            return 0;
        }
//        dump($res);
//        return $res;
    }
}